import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '名称',
    align:"center",
    dataIndex: 'mingc'
   },
   {
    title: '报名开始时间',
    align:"center",
    dataIndex: 'baomkssj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '报名截止时间',
    align:"center",
    dataIndex: 'baomjjsj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '当前赛程',
    align:"center",
    dataIndex: 'dangqsc_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'mingc',
    component: 'Input',
  },
  {
    label: '报名开始时间',
    field: 'baomkssj',
    component: 'DatePicker',
  },
  {
    label: '报名截止时间',
    field: 'baomjjsj',
    component: 'DatePicker',
  },
  {
    label: '参赛须知',
    field: 'cansxz',
    component: 'JEditor',
  },
  {
    label: '当前赛程',
    field: 'dangqsc',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"saisjc"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  mingc: {title: '名称',order: 0,view: 'text', type: 'string',},
  baomkssj: {title: '报名开始时间',order: 1,view: 'date', type: 'string',},
  baomjjsj: {title: '报名截止时间',order: 2,view: 'date', type: 'string',},
  dangqsc: {title: '当前赛程',order: 4,view: 'list', type: 'string',dictCode: 'saisjc',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}